

#include <algorithm>
#include <iostream>
#include <queue>
#include <vector>

#include "common/utils.hpp"

int getDepth(TreeNode* node) {
    if (node == nullptr) return 0;

    int lDepth = getDepth(node->left);
    int rDepth = getDepth(node->right);

    if (node->left == nullptr && node->right != nullptr) {
        return 1 + rDepth;
    }

    if (node->left != nullptr && node->right == nullptr) {
        return 1 + lDepth;
    }

    return 1 + std::min(lDepth, rDepth);
}

int minDepth(TreeNode* root) {
    return getDepth(root);
}

extern TreeNode* commonRoot;

int main() {
    int res = minDepth(commonRoot);
    std::cout << "res: " << res << "\n";
}